import { createApp } from 'vue'
import DesignerTestApp from '../DesignerTestApp.vue'

function runValidation() {
  console.log('Starting designer validation...')
  
  // 创建测试应用
  const app = createApp(DesignerTestApp)
  
  // 挂载到临时DOM
  const testContainer = document.createElement('div')
  document.body.appendChild(testContainer)
  app.mount(testContainer)
  
  // 验证预期
  setTimeout(() => {
    const logs = [
      'Command executed',
      'Text editor registered',
      'Current state:'
    ]
    
    const missingLogs = logs.filter(log => {
      return !Array.from(console._logs).some(l => l.includes(log))
    })
    
    if (missingLogs.length === 0) {
      console.log('✅ Designer validation passed! All systems operational.')
    } else {
      console.error('❌ Validation failed. Missing logs:', missingLogs)
    }
    
    // 清理
    app.unmount()
    document.body.removeChild(testContainer)
  }, 500)
}

// 拦截console.log用于验证
console._logs = []
const originalLog = console.log
console.log = function(...args) {
  console._logs.push(args.join(' '))
  originalLog.apply(console, args)
}

runValidation()